package demo_0402.homework;

public class T1 {
    public static String change(String str) {
        if (str == null || str.isEmpty()) return str;
        return str.substring(0,1).toUpperCase() + str.substring(1).toLowerCase();
    }
    public static void main(String[] args) {
        String[] strings = {
                "oliver smith",
                "noah bush" ,
                "harry brown" ,
                "jack wood" ,
                "charlie nixon" ,
                "jacob Weber",
                "lily Sandall",
                "emily Goodwin",
                "sophia Eberhardt",
                "ella Parker",
        };
        for (int i = 0; i < strings.length; i++) {
            String[] tmp = strings[i].split(" ");
            String firstName = change(tmp[0]);
            String lastName = change(tmp[1]);
            strings[i] = lastName + ", " + firstName;
        }

        for (int i = 0; i < strings.length; i++) {
            System.out.println(strings[i]);
        }
    }
}
